<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 输入月份，显示当月的天数。
        var year=parseInt(prompt("请输入年份"));
        var month=parseInt(prompt("请输入月份"));
        var leapYear=(year%4==0 && year%100>0)||year%400==0
        var commonYear=!leapYear
        if(leapYear && month==2){
            console.log("本月天数为"+29+"天")
        }else if(commonYear && month==2){
            console.log("本月天数为"+28+"天")
        }else if(month==1||month==3||month==5||month==7||month==8||month==10||month==12){
            console.log("本月天数为"+31+"天")
        }else if(month==4||month==6||month==9||month==11){
            console.log("本月天数为"+31+"天")
        }
    </script>
</body>
</html>